﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;

namespace ThreadDemo
{
    class Program
    {
        static void Main(string[] args)
        {
            Thread.CurrentThread.Name = "主线程";
            Console.WriteLine("1");
            Thread.Sleep(600);
            Console.WriteLine("2");
            Thread t = new Thread(new ThreadStart(NewThreadRun));
            t.Name = "我不是主线程";
            t.Start(); //开始新线程
            Thread.Sleep(600);
            Console.WriteLine("3");
            Thread.Sleep(600);
            Console.WriteLine("4");
            Thread.Sleep(600);
            Console.WriteLine("5");
            Thread.Sleep(600);
            Console.WriteLine("6");
            Console.Read();
        }
        static void NewThreadRun()
        {
            for (int i = 0; i < 10; i++)
            {
                
                Console.WriteLine(Thread.CurrentThread.Name + "NewThreadRun：" + i);
                Thread.Sleep(200);
            }
        }
    }
}
